
<h2>Peers</h2>

<div ng-repeat="org in ctl.getOrgs()">
  <blockquote>
    {{::org.name}}
  </blockquote>
  <ul>
    <li ng-repeat="peer in ctl.getPeers(org.id)">{{::peer['server-hostname']}}</li>
  </ul>
</div>


<h2>Uploaded Chaincodes ({{ctl.chaincodes.length||0}})</h2>
<ul class="list">
  <li ng-repeat="ch in ctl.chaincodes">{{::ch.name}} ({{::ch.version}})</li>
</ul>


<h2>Channels ({{ctl.channels.length||0}})</h2>
<ul class="list">
  <li ng-repeat="ch in ctl.channels">{{::ch.channel_id}}</li>
</ul>

<!-- channel selector -->
 <div class="form-group">
  <label>Channel</label>
  <select ng-model="selectedChannel" material-select watch ng-options="o.channel_id for o in ctl.channels" placeholder="Channel ID" required>
  </select>
</div>

<div ng-show="selectedChannel">


  <h2>Instatiated Chaincodes ({{ctl.channelChaincodes.length||0}})</h2>
  <ul class="list">
    <li ng-repeat="ch in ctl.channelChaincodes">{{::ch.name}} ({{::ch.version}})</li>
  </ul>

  <h2>Last block</h2>
  <json-formatter open="1" json="ctl.blockInfo"></json-formatter>


  <h2>Last transaction</h2>
  <div class="row">
    <div class="col s12">
      <ul class="tabs" tabs>
        <li class="tab col s3"><a class="active" href="#tab-result">Result</a></li>
        <li class="tab col s3"><a href="#tab-info">Info</a></li>
        <li class="tab col s3"><a href="#tab-json">Json</a></li>
      </ul>
    </div>

    <div id="tab-result" class="col s12">
      <!-- <json-formatter open="1" json="ctl.transaction.transactionEnvelope.payload.data.actions[0].payload.action.proposal_response_payload.extension.results.ns_rwset"></json-formatter> -->
      <json-formatter open="2" json="ctl.result"></json-formatter>
    </div>

    <div id="tab-info" class="col s12">
      <p ng-if="!ctl.transaction.transactionEnvelope"><i>No transaction</i></p>
      <certificate title="Transaction creator" data="ctl.transaction.transactionEnvelope.payload.data.actions[0].header.creator.IdBytes"></certificate>
      <div ng-repeat="e in ctl.transaction.transactionEnvelope.payload.data.actions[0].payload.action.endorsements">
        <certificate title="Endorser" data="e.endorser.IdBytes"></certificate>
        <!-- <json-formatter open="1" json="e.endorser"></json-formatter> -->
      </div>
      <!-- ctl.transaction.transactionEnvelope.payload.data.actions[0].payload.action.proposal_response_payload.extension.results.ns_rwset[].rwset.writes[](key|value|is_delete) -->
    </div>

    <div id="tab-json" class="col s12">
      <json-formatter open="1" json="ctl.transaction"></json-formatter>
    </div>
  </div>
</div>